 <%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ include file="/ecps/console/common/taglibs.jsp"%>
<head>
<title>商品录入及上下架管理_商品管理</title>
<meta name="heading" content="商品录入及上下架管理"/>
<meta name="menu" content="ItemMgmtMenu"/>
<script type="text/javascript" src="<c:url value='/${system}/res/js/jquery.form.js'/>"></script>
<script type="text/javascript" src="<c:url value='/${system}/res/js/jquery.tablesorter.js'/>"></script>
<script type="text/javascript">
$(function(){
	var showStatus = $("#showStatus").val();
	if(showStatus == '0'){
		$("#label5").attr("class", "here");
	}else if(showStatus == '1'){
		$("#label4").attr("class", "here");
	}else{
		$("#label6").attr("class", "here");
	}
	
	/* <div class="page_c">
    <span class="l inb_a">
    </span>
    <span class="r page">
        <input type="hidden" id="pageIndex" name="pageIndex" />
        <input type="hidden" value="${page.totalCount}" id="totalCount" name="totalCount" />
        <input type="hidden" value="${page.pageIndex}" id="currentpageIndex" name="currentpageIndex" />
        <input type="hidden" value="${page.totalPage}" id="totalPage" name="totalPage" />
                共<var id="pagePiece" class="orange">${page.totalCount }</var>条<var id="pageTotal">${page.pageIndex }/${page.totalPage }</var>
        <a href="javascript:void(0);" id="previous" class="hidden" title="上一页">上一页</a>
        <a href="javascript:void(0);" id="next" class="hidden" title="下一页">下一页</a>
    </span>
</div> */
	//获得当前页面和总页数
	var pageIndex = parseInt($("#currentpageIndex").val());
	var totalPage = parseInt($("#totalPage").val());
	
	if(pageIndex == 1 && pageIndex == totalPage){
		$("#previous").hide();
		$("#next").hide();
	}else if(pageIndex == 1 && pageIndex < totalPage){
		$("#previous").hide();
		$("#next").show();
	}else if(pageIndex > 1 && pageIndex < totalPage){
		$("#previous").show();
		$("#next").show();
	}else if(pageIndex > 1 && pageIndex == totalPage){
		$("#previous").show();
		$("#next").hide();
	}
	
	$("#next").click(function(){
		pageIndex++;
		$("#pageIndex").val(pageIndex);
		$("#form1").submit();
	});
	$("#previous").click(function(){
		pageIndex--;
		$("#pageIndex").val(pageIndex);
		$("#form1").submit();
	});
	$("#firstPage").click(function(){
		
		$("#pageIndex").val(1);
		$("#form1").submit();
	});
	$("#lastPage").click(function(){
		
		$("#pageIndex").val(totalPage);
		$("#form1").submit();
	});
	
	$("#selectPage").change(function(){
		var page = $(this).val();
		$("#pageIndex").val(page);
		$("#form1").submit();
	});
	
	$("#selectPage").val(pageIndex);
	
	$("#confirmOk").click(function(){
		
		$("#showForm").submit();
	});
});
function isShow(itemId, showStatus){
	
	
	tipShow("#confirm");
	//给表单赋值
	$("#itemId").val(itemId);
	$("#myShowStatus").val(showStatus);
}
</script>
</head>
<body id="main">
<form action="${path }/item/showGoods.do" id="showForm" method="post">
	<input type="hidden" name="goodsId" id="itemId">
	<input type="hidden" name="showStatus" id="myShowStatus">
</form>
<div class="frameL"><div class="menu icon">
    <jsp:include page="/${system}/common/itemmenu.jsp"/>
</div></div>

<div class="frameR"><div class="content">

    <div class="loc icon"><samp class="t12"></samp>当前位置：商品管理&nbsp;&raquo;&nbsp;<span class="gray" title="商品录入及上下架">商品录入及上下架</span></div>

    <h2 class="h2_ch"><span id="tabs" class="l">
        <a id="label6" href="${path}/item/list.do?auditStatus=1"   title="全部实体商品" class="nor">全部</a>
        <a id="label4" href="${path}/item/list.do?showStatus=1&auditStatus=1"   title="未上架实体商品" class="nor">未上架</a>
        <a id="label5" href="${path}/item/list.do?showStatus=0&auditStatus=1"  title="已上架实体商品" class="nor">已上架</a>
    </span></h2>

<form id="form1" name="form1" action="${path}/item/list.do" method="post">
   <input id="showStatus" type="hidden" name="showStatus" value="${gqc.showStatus }">
    <div class="sch">
        <p>搜索：
        <select id="brandId" name="brandId">
        	<option value="">请选择品牌</option>
            <c:forEach items="${bList }" var="brand">
            	<option value="${brand.brandId }" <c:if test="${gqc.brandId == brand.brandId }">selected</c:if> >${brand.brandName }</option>
            </c:forEach>
        </select>
        <select id="auditStatus" name="auditStatus" >
        	<option value="" selected>全部审核状态</option>
        	<option value="0" <c:if test="${gqc.auditStatus == 0 }">selected</c:if> >待审核</option>
        	<option value="1" <c:if test="${gqc.auditStatus == 1 }">selected</c:if>>通过</option>
        	<option value="2" <c:if test="${gqc.auditStatus == 2 }">selected</c:if>>不通过</option>
        </select>
        <input type="text" id="searchText" value="${gqc.goodsName }" name="goodsName" title="请输入商品名称" class="text20 medium gray" />
        <input type="submit" id="goSearch" class="hand btn60x20" value="查询" />
    </p></div>

    <div class="page_c">
        <span class="l">
        </span>
        <span class="r inb_a">
            <a href="${path}/item/toAdd.do" class="btn80x20" title="添加商品">添加商品</a>
        </span>
    </div>

	<table cellspacing="0" summary="" class="tab" id="myTable">
		<thead>
			<tr>
				<th>商品编号</th>
	            <th class="wp">商品名称</th>
	            <th>图片</th>
				<th>新品</th>
				<th>推荐</th>
				<th>特价</th>
	            <th>上下架</th>
	            <th>审核状态</th>
				<th>操作</th>
			</tr>
		</thead>
		<tbody>
		<c:forEach items="${page.list }" var="item">
			<tr>
				<td>${item.goodsNum }</td>
                <td >${item.goodsName }</td>
                <td><img alt="" src="${file_path }${item.imgRelativePath}" width="50" height="50"></td>
				
				<td>
					<c:if test="${item.isNew == 1 }"><span class="is" ></span></c:if>
					<c:if test="${item.isNew == 0 }"><span class="not" ></span></c:if>
				</td>
				<td>
					<c:if test="${item.isGroom == 1 }"><span class="is" ></span></c:if>
					<c:if test="${item.isGroom == 0 }"><span class="not" ></span></c:if>
					
				</td>
				<td>
					<c:if test="${item.isHot == 1 }"><span class="is" ></span></c:if>
					<c:if test="${item.isHot == 0 }"><span class="not" ></span></c:if>
					
				</td>
                <td>
                	<c:if test="${item.showStatus == 0 }"><span class="is" ></span></c:if>
					<c:if test="${item.showStatus == 1 }"><span class="not" ></span></c:if>
					
                </td>
                <td>
                	
					<c:if test="${item.auditStatus == 0 }">待审核</c:if>
					<c:if test="${item.auditStatus == 1 }">通过</c:if>
					<c:if test="${item.auditStatus == 2 }">不通过</c:if>
					
                </td>
               
				<td>
					<a href="/ecps-console/shop/item/viewItem.jsp" title="查看">查看</a>
			  	
			  		
			  			<c:if test="${item.showStatus == 1 }">
			  				<a href="/ecps-console/ecps/console/item/editGoods.do?type=1&goodsId=2384">编辑</a>
			  				<a href="javascript:void(0);" onclick="singleDel('2384')">删除</a>
			  				<a href="javascript:void(0);" onclick="isShow(${item.goodsId}, 0)">上架</a>
			  			</c:if>
			  			<c:if test="${item.showStatus == 0 }">
			  				<a href="javascript:void(0);" onclick="isShow(${item.goodsId}, 1)">下架</a>
			  				<a href="${path }/item/publish.do?goodsId=${item.goodsId}" >发布</a>
			  			</c:if>
					  			
				</td>
			</tr>
		</c:forEach>
			
			</tbody>
			<tr>
				<td colspan="13" align="right">
                选择：<a href="javascript:void(0);" title="全选" onclick="checkAllIds();">全选</a>
                <samp>-</samp> <a href="javascript:void(0);" title="取消" onclick="uncheckAllIds()">取消</a>
				</td>
			</tr>
	</table>
    
	<div class="page_c">
        <span class="l inb_a">
        </span>
        <span class="r page">
            <input type="hidden" id="pageIndex" name="pageIndex" />
            <input type="hidden" value="${page.totalCount}" id="totalCount" name="totalCount" />
            <input type="hidden" value="${page.pageIndex}" id="currentpageIndex" name="currentPageIndex" />
            <input type="hidden" value="${page.totalPage}" id="totalPage" name="totalPage" />
                    共<var id="pagePiece" class="orange">${page.totalCount }</var>条<var id="pageTotal">${page.pageIndex }/${page.totalPage }</var>
            <a href="javascript:void(0);" id="firstPage"  >首页</a>
            <a href="javascript:void(0);" id="previous" class="hidden" title="上一页">上一页</a>
            <a href="javascript:void(0);" id="next" class="hidden" title="下一页">下一页</a>
            <select id="selectPage">
            	<c:forEach begin="1" end="${page.totalPage }" var="myPage">
            		<option value="${myPage }">第${myPage }页</option>
            	</c:forEach>
            </select>
            <a href="javascript:void(0);" id="lastPage"  >尾页</a>
        </span>
    </div>
</form>
</body>